import request from '@/utils/request.js'

// 评论状态枚举
export const CommentStatus = {
    PENDING: 'pending',
    PUBLISHED: 'published',
    DELETED: 'deleted'
}

// 评论管理
export const commentCreateService = (data) => {
    return request.post('/api/comment', data)
}

export const commentListService = (articleId, params) => {
    return request.get(`/api/comment/article/${articleId}`, { params })
}

export const commentReplyService = (data) => {
    return request.post('/api/comment/reply', data)
}

export const commentUpdateService = (id, data) => {
    return request.put(`/api/comment/${id}`, data)
}

export const commentDeleteService = (id) => {
    return request.delete(`/api/comment/${id}`)
}

export const commentLikeService = (id) => {
    return request.patch(`/api/comment/${id}/like`)
}

export const commentStatusUpdateService = (id, status) => {
    return request.patch(`/api/comment/${id}/status`, { status })
}

export const commentBatchDeleteService = (ids) => {
    return request.delete('/api/comment/batch', { data: { ids } })
}